<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of ArraySource
 *
 * @author Diego
 */
class ArraySource implements IDropDownDataSource{
    
    /**
     * The static data set
     * @example $static = array(
     * 			    array("value" => "S", "text" => "Si"),
     * 			    array("value" => "N", "text" => "No")
     * 		    )
     * @var array 
     */
    private $_staticData;

    /**
     * Set the entire data to populate the dropdown
     * @example $options = array("value" => "valueData", "text" => "textData")
     * @param array $options 
     */
    public function setStaticData(array $options) {
        $this->_staticData = $options;
    }

    /**
     * Return parsed early set static data needed for the dropdown options 
     * @return array 
     */
    private function _getStaticData() {
        $parsedOptionGroup = array();
        foreach ($this->_staticData as $oneOptionStaticData) {
            $parsedOption = $this->_parseStaticData($oneOptionStaticData);
            array_push($parsedOptionGroup, $parsedOption);
        }
        return $parsedOptionGroup;
    }

    /**
     * Parse the static data set early
     * @param type $staticData
     * @return \stdClass 
     */
    private function _parseStaticData($staticData) {
        $tmpOption = new stdClass();
        $tmpOption->value = $staticData["value"];
        $tmpOption->text = $staticData["text"];
        return $tmpOption;
    }
    
    public function getOptionsData(array $parameters = array()) {
        
    }
}

?>

